#!/bin/bash

function rsa_signature()
{
    echo "默认签名"
    # 1.签名
    openssl dgst -sign private_key.pem -out signature.bin file.txt
    # 2.验签
    openssl dgst -verify public_key.pem -signature signature.bin file.txt
}

function rsa_sha256_signature()
{
    echo "sha256签名"
    # 1.签名
    openssl dgst -sha256 -sign private_key.pem -out signature.bin file.txt
    # 2.验签
    openssl dgst -sha256 -verify public_key.pem -signature signature.bin file.txt
}

rsa_signature 
rsa_sha256_signature